<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set> 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>单个商品显示</title>
    <link rel="shortcut icon" href="${ctx}/favicon.ico"> <link href="${ctx}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${ctx}/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="${ctx}/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="${ctx}/css/animate.css" rel="stylesheet">
    <link href="${ctx}/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="${ctx}/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="${ctx}/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
</head>
<body>
    
       <div style="border-style: solid; border-width: 1px;height:510px;margin:20px; width:60%;">
            <div style="border-style: solid; border-width: 1px;width:50%;height:400px;margin-top:30px;margin-left:30px;margin-bottom:20px;padding:1px;">
                <img src="${ctx}${houseGoods.picture}"alt="图片" style="width:100%;height:400px;">
            </div>
            <!-- <label style="margin-left:90px;">图片地址:</label>
            <input type="text" name="" id="" readonly="readonly"> -->
            
 			<div style="width:50%;height:30px;">
 				<form id="tf" action="${ctx}/SingleGoodsServlet/upoadPicture" method="post" enctype="multipart/form-data">
	                <input type="file" name="file" style="float: left;margin-left:80px;"/>
	                <input type="hidden" name="h_goods_id" value="${houseGoods.h_goods_id}">
	                <!-- <input class="btn" style="float: left;" type="submit" onclick="uploadForm()"value="提交">  -->
	                <button style="float: left;" type="submit">提交</button>               
 				</form>
            </div>
            
            
            <div style="float: right;width:38%;height:400px;margin-top:-410px;margin-right:30px;">
                <div style="width:100%;height:40px;padding-top:5px;">
                    <label class="col-sm-4" style="margin-top:2px;">商品编号：</label>
                    <input class="col-sm-8" type="text" name="" id="" readonly="readonly" value="${houseGoods.h_goods_id}">
                </div>
                <div style="width:100%;height:40px;padding-top:5px;">
                    <label class="col-sm-4" style="margin-top:2px;">商品名称：</label>
                    <input class="col-sm-8" type="text" name="" id="" readonly="readonly"value="${houseGoods.goods_name}">
                </div>
                <div style="width:100%;height:40px;padding-top:5px;">
                    <label class="col-sm-4" style="margin-top:2px;">总数量：</label>
                    <input class="col-sm-8" type="text" name="" id="" readonly="readonly"value="${houseGoods.number}${houseGoods.unit}">
                </div>
                <div style="width:100%;height:40px;padding-top:5px;">
                    <label class="col-sm-4" style="margin-top:2px;">总金额：</label>
                    <input class="col-sm-8" type="text" name="" id="" readonly="readonly"value="${houseGoods.sum}元">
                </div>
                <div style="width:100%;height:40px;padding-top:5px;">
                    <label class="col-sm-4" style="margin-top:2px;">总体积：</label>
                    <input class="col-sm-8" type="text" name="" id="" readonly="readonly"value="${houseGoods.volume}立方米">
                </div>
                <div style="width:100%;height:40px;padding-top:5px;">
                    <label class="col-sm-4" style="margin-top:2px;">仓库：</label>
                    <input class="col-sm-8" type="text" name="" id="" readonly="readonly"value="${houseGoods.storehouse_name}">
                </div>
                <div style="width:100%;height:40px;padding-top:5px;">
                    <label class="col-sm-4" style="margin-top:2px;">备注：</label>
                    <textarea class="col-sm-8" name="" id="" cols="30" rows="6" readonly="readonly">${houseGoods.remark}</textarea>                  
                </div>
                <div style="width:100%;height:40px;padding-top:5px;">
                    <button style="margin-top:20px;margin-left:50px;" onclick="outInfo()">导出${houseGoods.goods_name}信息</button>              
                </div>
            </div>
             </div>
            <!-- 富文本编译器 -->
      <div style="border-style: solid; border-width: 1px;height:510px;margin:20px auto; width:35%;float: right;margin-top:-530px;margin-right:30px;">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>商品介绍</h5>
                        <button id="edit" class="btn btn-primary btn-xs m-l-sm" onclick="edit()" type="button">编辑</button>
                        <button id="save" class="btn btn-primary  btn-xs" onclick="save()" type="button">保存</button>
                        <div class="ibox-tools">
                            
                        </div>
                    </div>
                    <div class="ibox-content" id="eg">   
                        <div class="click2edit wrapper" style="display: block;">
                            ${houseGoods.introduce}
                        </div>   
                    </div>
                </div>
            </div>
        </div>

       </div>
            
      
</body>
<script src="${ctx}/js/jquery.min.js?v=2.1.4"></script>
<script src="${ctx}/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${ctx}/dist\layer-v3.1.1\layer\layer.js"></script>
<!-- SUMMERNOTE -->
<script src="${ctx}/js/plugins/summernote/summernote.min.js"></script>
<script src="${ctx}/js/plugins/summernote/summernote-zh-CN.js"></script>

<script>
	function outInfo(){
		$.get('${ctx}/SingleGoodsServlet/outGoodsInfo',{'h_goods_id':${houseGoods.h_goods_id}},function(data){
			if(data){
				layer.msg("已成功导出到D盘！");
			}else{
				layer.msg("导出失败！");
			}
		});
	}

    $(document).ready(function () {

        $('.summernote').summernote({
            lang: 'zh-CN'
        });

    });
    var edit = function () {
        $("#eg").addClass("no-padding");
        $('.click2edit').summernote({
            lang: 'zh-CN',
            focus: true
        });
    };
    var save = function () {
        $("#eg").removeClass("no-padding");
        var aHTML = $('.click2edit').code(); //save HTML If you need(aHTML: array).
        $.get('${ctx}/SingleGoodsServlet/upoadIntrodcue',{'introduce':aHTML,'h_goods_id':${houseGoods.h_goods_id}},function(data){
        	if(data){
        		layer.msg("保存成功");
        	}else{
        		layer.msg("保存失败");
        	}
        });
        $('.click2edit').destroy();
    };
</script>
<script type="text/javascript">
/* 	function uploadForm(){
		$.get('${ctx}/SingleGoodsServlet/upoadPicture',$('form').serialize(),function(data){
			if(data){
				layer.msg("上传图片成功");
			}else{
				layer.msg("上传图片失败");
			}
		});
	} */
/* 	function uploadForm(){
		FormData form=new  FormData(document.getElementById("tf"));
		$.ajax({  
            type: 'post',  
            url: "${ctx}/SingleGoodsServlet/upoadPicture",  
            data: form, 
            cache: false,  
            processData: false,  
            contentType: false,  
        }).success(function (data) {  
            alert("上传成功");  
        }).error(function () {  
            alert("上传失败");  
        });  
	} */
</script>
</html>